package com.wenhao.mi;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-09-01 19:24
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int cur = 0;
        for (int i = 2;i <= n;i++) {
            cur = (3 + cur) % i;
        }
        System.out.println(cur + 1);
    }
}
